import Vue from 'vue'
import VueRouter from 'vue-router'
import ViewUI from 'view-design';
Vue.use(ViewUI);
Vue.use(VueRouter)




let router = new VueRouter({
    routes: [{
            path: '/',
            meta: {
                title: "首页"
            },
            component: () => import('../page/Home')
        },
        {
            path: '/cart',
            meta: {
                title: "题库"
            },
            component: () => import('../page/Cart')
        },
        {
            path: '/chart',
            meta: {
                title: "图表案例"
            },
            component: () => import('../page/Chart')
        },
        {
            path: '/add',
            meta: {
                title: "添加题目"
            },
            component: () => import('../page/Add')
        },
        {
            path: "*",
            meta: {
                title: "404-页面不存在"
            },
            component: () => import('../page/Error/E404')
        }
    ]

})
router.beforeEach((to, from, next) => {
    ViewUI.LoadingBar.start();
    next();
});

router.afterEach(() => {
    ViewUI.LoadingBar.finish();
});
export default router